package com.bstek.service.impl;

import com.bstek.service.CheckFailedAction;
import com.bstek.urule.RuleException;
import org.springframework.stereotype.Component;

/**
 * @Author: zhangxin
 * @Date: 2021/12/14 6:15 下午
 * @email： zhangxin1084@xdf.cn
 * @Description：
 */
@Component("CheckFailedAction")
public class CheckFailedActionImpl implements CheckFailedAction {
    /**
     * 动作：抛出检验失败的异常
     *
     * @param message
     */
    @Override
    public void action(String message) {
        throw new RuleException(message);
    }

    @Override
    public String message(Integer difficuty) {
        if (null == difficuty || 4 <= difficuty) {
            return "fail";
        }
        return "success";
    }
}
